package cn.pet_know.controller;

import cn.pet_know.common.result.R;
import cn.pet_know.entity.dto.KnowledgeTypeDTO;
import cn.pet_know.entity.vo.KnowledgeTypeVO;
import cn.pet_know.service.KnowledgeTypeService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/knowledgeType")
public class KnowledgeTypeController {

    @Resource
    private KnowledgeTypeService knowledgeTypeService;

    @PostMapping("/addType")
    public R<Boolean> addType(@RequestBody KnowledgeTypeDTO knowledgeTypeDTO) {
        return R.ok(knowledgeTypeService.addType(knowledgeTypeDTO));
    }
    @PostMapping("/listType")
    public R<List<KnowledgeTypeVO>> listType(@RequestBody KnowledgeTypeDTO knowledgeTypeDTO) {
        return R.ok(knowledgeTypeService.listType(knowledgeTypeDTO));
    }
    @PostMapping("/delType")
    public R<Boolean> delType(@RequestBody KnowledgeTypeDTO knowledgeTypeDTO) {
        return R.ok(knowledgeTypeService.delType(knowledgeTypeDTO));
    }

}